﻿<?php
require_once('konfiguration.html');

//$files=array("hungarian"=>"hungarisch10000.txt");
$files=array("swedish"=>"2000mostcommonswedish.txt");
foreach ($files as $key=> $value)
{
   $lines=file($value);
   print "$key";
   foreach($lines as $line)
   { 
      preg_match_all('/([^\s]*)[\s][0-9]+/',$line,$matches,PREG_PATTERN_ORDER);
	  print_r($matches);
	  $line_correct=$matches[1][0];
	  
	  $line_correct=str_replace  (  "°a"  ,  "å" , $line_correct );
	  $line_correct=str_replace  (  "¨o"  ,  "ö" , $line_correct );
	  $line_correct=str_replace  (  "¨a"  ,  "ä" , $line_correct );
	  //print htmlentities($line_correct[0]).'<br>';
	  //print "Добро пожаловать!";
         print_r($matches);
	 print $line_correct.'<br>';
	 
          mysql_query("INSERT INTO mostcommonwords VALUES ('$key','$line_correct',$index)");
	  
	  $index+=1;
	  set_time_limit(30);
   
   }

}

//DELETE FROM `mostcommonwords` WHERE language='russian'

?>